package com.jeeplus.test.jlnu.employmentInfo.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.AllInfo;
import com.jeeplus.test.jlnu.archivalInfo.domain.entity.ArchParmerter;
import com.jeeplus.test.jlnu.employmentInfo.domain.vo.EmploymentInfoReqVo;
import com.jeeplus.test.jlnu.employmentInfo.domain.vo.EmploymentInfoRespVo;
import com.jeeplus.test.jlnu.employmentInfo.service.EmploymentInfoService;
import com.jeeplus.test.tools.resp.R;
import com.jeeplus.test.tools.resp.ZyPage;
import com.jeeplus.test.tools.resp.ZyPageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "就业信息")
@RestController
@Slf4j
@RequestMapping("/employmentInfo")
public class EmploymentInfoController {

    @Autowired
    private EmploymentInfoService employmentInfoService;

    @ApiOperation("就业信息分页查询")
    @GetMapping("/page")
    public Page<EmploymentInfoRespVo> getEmploymentInfoPage(ArchParmerter employmentInfoReqVo, @RequestParam(defaultValue = "1") int pageNum,
                                                            @RequestParam(defaultValue = "10") int pageSize) {
        Page<EmploymentInfoRespVo> page = new Page<>(pageNum, pageSize);
        Page<EmploymentInfoRespVo> pageResult = employmentInfoService.getEmploymentInfoPage(employmentInfoReqVo, page);
        return pageResult;
    }

    @ApiOperation("selectempLoyList分页查询")
    @GetMapping("selectempLoyList")
    public R<ZyPage<EmploymentInfoRespVo>> selectempLoyList(EmploymentInfoReqVo employmentInfoReqVo, ZyPageRequest zyPageRequest){
        long current = zyPageRequest.getPageNo();
        long size = zyPageRequest.getPageSize();
        Page<EmploymentInfoRespVo> pageResult = employmentInfoService.selectempLoyList(employmentInfoReqVo, current, size);
        List<EmploymentInfoRespVo> dataList = pageResult.getRecords();
        long total = pageResult.getTotal();
        ZyPage<EmploymentInfoRespVo> retPage = ZyPage.getPage(dataList, zyPageRequest, total);
        return R.suc(retPage);
    }



}
